//
//  AIGirlLoadingViewController.swift
//  AIGirl
//
//  Created by Rae on 2024/1/30.
//

import UIKit

class AIGirlLoadingViewController: AIGirlBaseViewController, AIGirlLottieAnimationProtocol {

    private lazy var backView = c_make_ex(UIImageView.self)
        .mode(.scaleAspectFill).end()
    private lazy var animateView: AIGirlLottieAnimationView = {
        lottieAnimation.make(.info_loading, loopMode: .playOnce)
    }()
    private lazy var titleLabel = c_make_ex(UILabel.self)
        .color("#DB40FC").font(16.font_regular).alignment(.center)
        .text("Your girl is getting ready… Please wait").end()
    
    override func viewDidLoad() {
        super.viewDidLoad()

        view.subviews{
            backView
            backView
            animateView
            titleLabel
        }
        
        backView.fillContainer()
        titleLabel.bottom(105).centerHorizontally()
        animateView.leading(25).trailing(25).height(25)
        animateView.Bottom == titleLabel.Top - 10
        
        let imgStr = UserDefaultsManager.getString(forKey: .girlAvatar)
        backView.loadImage(url: imgStr)
        animateView.play { _ in
            let tabVC = AIGirlTabBarViewController()
            tabVC.toMsgVC()
            UIApplication.window?.rootViewController = tabVC
        }
    }
    


}
